package com.wzcl.app.model.vo;

import com.wzcl.app.dao.model.Grade;
import com.wzcl.app.model.common.WZCL;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.Map;

@EqualsAndHashCode(callSuper = false)
@Data
public class GradeVo extends BaseVo {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "年级名")
    private String name;

    @ApiModelProperty(value = "类型")
    private Integer type;
    private String  typeStr;

    @ApiModelProperty(value = "年级学科")
    private List<SubjectVo> subjectVos;

    private GradeVo(){}

    public static GradeVo create(Grade grade){
        GradeVo gradeVo = new GradeVo();
        BeanUtils.copyProperties(grade,gradeVo);
        gradeVo.translationValueStr();
        return gradeVo;
    }

    @Override
    public void translationValueStr() {
        Map<String, Map<Integer, String>> map = getTranslationMap();
        this.typeStr = map.get(WZCL.GROUP_NAME.GRADE_TYPE).get(this.type);
    }

    @Override
    public void processResources() {

    }
}
